home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / ActiveX Controlls / NCTAudioEditor2 ActiveX DLL / NCTAudioEditor2.exe / {app} / Samples / TestDelphiAudioEditor2 / Info.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-03-28  |  3.8 KB  |  121 lines

  1. unit Info;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, ExtCtrls, NCTAUDIOEDITOR2Lib_TLB;
  8.  
  9. type
  10.   TfrmInfo = class(TForm)
  11.     Label5: TLabel;
  12.     infoTitle: TEdit;
  13.     Label6: TLabel;
  14.     infoArtist: TEdit;
  15.     Label7: TLabel;
  16.     infoAlbum: TEdit;
  17.     Label12: TLabel;
  18.     infoGenre: TComboBox;
  19.     Label8: TLabel;
  20.     infoCopyright: TEdit;
  21.     Label9: TLabel;
  22.     infoYear: TEdit;
  23.     Label10: TLabel;
  24.     infoTrack: TEdit;
  25.     Label11: TLabel;
  26.     infoComment: TEdit;
  27.     btnApply: TButton;
  28.     btnReset: TButton;
  29.     infoMTV: TRadioGroup;
  30.     Label3: TLabel;
  31.     infoComposer: TEdit;
  32.     Label4: TLabel;
  33.     infoEncodedBy: TEdit;
  34.     Label13: TLabel;
  35.     infoURL: TEdit;
  36.     procedure btnResetClick(Sender: TObject);
  37.     procedure btnApplyClick(Sender: TObject);
  38.     procedure FormCreate(Sender: TObject);
  39.     procedure FormShow(Sender: TObject);
  40.   private
  41.     { Private declarations }
  42.     procedure ResetData;
  43.   public
  44.     { Public declarations }
  45.     Info: IAudioEditor2FileInfo;
  46.   end;
  47.  
  48. var
  49.   frmInfo: TfrmInfo;
  50.  
  51. implementation
  52.  
  53. uses Main;
  54.  
  55. {$R *.dfm}
  56. //---------------------------------------------------------------------------
  57.  
  58. procedure TfrmInfo.ResetData;
  59. begin
  60.     infoTitle.Text := Info.Title;
  61.     infoArtist.Text := Info.Artist;
  62.     infoAlbum.Text := Info.Album;
  63.     infoGenre.ItemIndex := Info.Genre;
  64.     infoCopyright.Text := Info.Copyright;
  65.     infoComment.Text := Info.Comments;
  66.     infoYear.Text := IntToStr(Info.Year);
  67.     infoTrack.Text := IntToStr(Info.Track);
  68.     infoComposer.Text := Info.Composer;
  69.     infoURL.Text := Info.URL;
  70.     infoEncodedBy.Text := Info.EncodedBy;
  71. end;
  72. procedure TfrmInfo.btnResetClick(Sender: TObject);
  73. begin
  74.     ResetData();
  75. end;
  76. //---------------------------------------------------------------------------
  77. procedure TfrmInfo.btnApplyClick(Sender: TObject);
  78. begin
  79.     Info.set_Title(StringToOleStr(infoTitle.Text));         //Sets a new title of the audio file subject
  80.     Info.set_Artist(StringToOleStr(infoArtist.Text));       //Sets a new name of the artist who created the original subject of the file
  81.     Info.set_Album(StringToOleStr(infoAlbum.Text));         //Sets a new Album name which contains the original audio file subject
  82.     Info.Genre := infoGenre.ItemIndex;    //Sets a new user-defined genre of the audio subject
  83.     Info.set_Copyright(StringToOleStr(infoCopyright.Text)); //Sets new copyright information for the audio file
  84.     Info.set_Comments(StringToOleStr(infoComment.Text));    //Sets new user-defined comments concerning an audio file
  85.     try
  86.         Info.Year := StrToInt(infoYear.Text);     //Sets the new year of the audio file//s subject to be first performed
  87.     except
  88.         ShowMessage('Invalid Year Value');
  89.         infoYear.SetFocus();
  90.         Exit;
  91.     end;
  92.     try
  93.         Info.Track := StrToInt(infoTrack.Text);
  94.     except
  95.         ShowMessage('Invalid Track Value');
  96.         infoTrack.SetFocus();
  97.         Exit;
  98.     end;
  99.     Info.set_URL(StringToOleStr(infoURL.Text));
  100.     Info.set_Composer(StringToOleStr(infoComposer.Text));
  101.     Info.set_EncodedBy(StringToOleStr(infoEncodedBy.Text));
  102. end;
  103. //---------------------------------------------------------------------------
  104. procedure TfrmInfo.FormShow(Sender: TObject);
  105. begin
  106.     Info := frmMain.AudioEditor1.FileInfo;
  107.     ResetData();
  108. end;
  109. //---------------------------------------------------------------------------
  110. procedure TfrmInfo.FormCreate(Sender: TObject);
  111. var
  112.     i: Integer;
  113. begin
  114.     for i := 0 to 141 do begin
  115.         //The list of genres is being filled with 148 elements using this cycle
  116.         infoGenre.Items.Add(frmMain.AudioEditor1.FileInfo.GenreToString(i));
  117.     end;
  118. end;
  119. //---------------------------------------------------------------------------
  120. end.
  121.